Home

Operator Usage

Name

tensor-product

Description

tensor-product[str] input-seq
implements a tensor product (see Wikipedia) of the superpositions in the input sequence
and returns a superposition of the resulting kets
in the simplest case, if given a sequence of two kets, c1|s1> . c2|s2>, the result is c1*c2|s1 . s2>
where in this case we used " . " for the separator string
in the general case, we return a sum of the tensor product of all the input kets
if the input sequence contains the empty ket, then ignore that ket
tensor-product should speed up a couple of algos


Examples

-- start with the simplest example, an input sequence of two kets:
tensor-product[" . "] (2|a> . 3|b>)
    6|a . b>

-- another simple example, an input sequence of some kets:
tensor-product[" . "] (2|a> . 3|b> . 5|c> . 7|d>)
    210|a . b . c . d>

-- this time a length 3 sequence:
tensor-product[" . "] (2|a1> + 3|a2> . 5|b1> + 7|b2> . 11|c1>)
    110|a1 . b1 . c1> + 154|a1 . b2 . c1> + 165|a2 . b1 . c1> + 231|a2 . b2. c1>

-- an example with empty kets:
tensor-product[" . "] (|> . |> . 3|a> . 5|b>)
    15|a . b>

-- and another:
tensor-product[" . "] (|> . 3|a> . |> . |> . 5|b> . |> . |> . |>)
    15|a . b>


See also

Operator type

sequence compound